/***********************************************************************
    filename:   DaterMainCalendarDayWindow.h
    created:    10/4/2012
    author:     4Ys

    purpose:    Defines class for MainCalendarDayWindow objects in UI
*************************************************************************/
#ifndef	_DaterMainCalendarDayWindow_h_
#define _DaterMainCalendarDayWindow_h_

#include "DaterMainWindow.h"
#include "DaterMainCalendarWindow.h"
#include "DaterEventBlockWindow.h"

#include <vector>
#include <string>
#include <deque>

class MainCalendarDayWindow : public MainCalendarWindow
{
	/* !
	\brief
		The Events in Day version.
	*/
public:
		/* !
		\brief
			Construct the sample of class MainCalendarDayWindow.

		\param id_name
			- a string to represent the prefix of the window.
			
		\param parent
			- point to parent window.
		*/
	MainCalendarDayWindow(const CEGUI::String& id_name, CEGUI::Window* parent = 0);
		
		/* !
			Destructor of class MainCalendarDayWindow.
		*/
	~MainCalendarDayWindow();

		/* !
		\brief
			a virtual function generated from class MainCalendarWindow to show window.
		*/
	virtual void showWindow();
	
		/* !
		\brief
			a virtual function generated from class MainCalendarWindow to hide window.
		*/
	virtual void hideWindow();

	void setToNext();
	void setToPrevious();

		/* !
		\brief
			a virtual function generated from class MainCalendarWindow to set to next.
		*/

	virtual bool setToNext(const CEGUI::EventArgs &args);

		/* !
		\brief
			a virtual function generated from class MainCalendarWindow to set to previous.
		*/
	virtual bool setToPrevious(const CEGUI::EventArgs &args);

	void setToSpecifiedDay(int year, int month, int day);

		/* !
		\brief
			a virtual function generated from class MainCalendarWindow to get head text.
		*/

	virtual std::string getHeadText();

		/* !
		\brief
			a virtual function generated from class MainCalendarWindow to refresh event.
		*/
	virtual void refreshEvent();

private:
		//! Member to subscribe handler to each 'slot' in the layout.
    void subscribeEvents();

	bool MouseWheel(const CEGUI::EventArgs& args);

	bool MouseButtonDown(const CEGUI::EventArgs& args);

	bool MouseButtonUp(const CEGUI::EventArgs& args);

	bool MouseEnters(const CEGUI::EventArgs& args);

	void updateBlockAmount(EventBlockWindow*);

	bool judgeEventConflit(Dater::Event*, Dater::Event*);

	void refreshAddEvent();

	int _year;

	int _month;

	int _day;

	int _yearDay;

	bool on_addEvent;

	std::deque<CEGUI::Window*> _choosenWindows;

	std::map<int, std::vector<EventBlockWindow*>> _eventBlockWindowMap;
};

#endif